package com.cyjf.dbview.mapper;

import com.cyjf.dbview.model.ZscarSalesOrderPaymentdocument;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

public interface ZscarSalesOrderPaymentdocumentMapper extends Mapper<ZscarSalesOrderPaymentdocument> {

    @Select("SELECT\n" +
            "ROUND(SUM(amount)/10000,2) as \"yesterdayTrade\"\n" +
            "FROM  zscartm1jucom2.zscar_sales_order_paymentdocument\n" +
            "WHERE deal_status=2 and pay_status=1\n" +
            "and from_unixtime(create_time,'%Y/%m/%d') =date_sub(date(now()),interval 1 day)")
    Float getYesterdayTrade();


    @Select("SELECT\n" +
            "ROUND(SUM(amount)/10000,2) as \"近7天交易额（万元）\"\n" +
            "FROM  zscartm1jucom2.zscar_sales_order_paymentdocument\n" +
            "WHERE deal_status=2 and pay_status=1\n" +
            "and from_unixtime(create_time,'%Y/%m/%d') between date_sub(date(now()),interval 8 day) and date_sub(date(now()),interval 1 day)")
    Float getRecent7Days();


    @Select("SELECT\n" +
            "ROUND(SUM(amount)/10000,2) as \"本月交易额(万元)\"\n" +
            "FROM  zscartm1jucom2.zscar_sales_order_paymentdocument\n" +
            "WHERE deal_status=2 and pay_status=1\n" +
            "and from_unixtime(create_time,'%Y/%m') =DATE_FORMAT(NOW(),'%Y/%m')")
    Float getCurMonth();


    @Select("SELECT\n" +
            "ROUND(SUM(amount)/10000,2) as \"本年交易额（万元）\"\n" +
            "FROM  zscartm1jucom2.zscar_sales_order_paymentdocument\n" +
            "WHERE deal_status=2 and pay_status=1\n" +
            "and from_unixtime(create_time,'%Y') =DATE_FORMAT(NOW(),'%Y')")
    Float getCurYear();


    @Select("SELECT\n" +
            "ROUND(SUM(amount)/10000,2) as \"累计交易额（万元）\"\n" +
            "FROM  zscartm1jucom2.zscar_sales_order_paymentdocument\n" +
            "WHERE deal_status=2 and pay_status=1\n" +
            "and from_unixtime(create_time,'%Y/%m/%d') <DATE(NOW()) ")
    Float accumulative();





}